Option Public
Option Declare

'Initialize Java Virtual Machine (JVM)
UseLSX "*javacon"
Sub Initialize()
'/**
' * LotusScript调用Java例子
' * 
' * @depends
' * @see
' * @error
' * @version 1.0
' * @author
' */
try:
	'set up error handler
	On Error GoTo catch

	
	Dim jclass As JavaClass
	Dim localHost As JavaObject
	'Establish JVM connection (JavaSession)
	Dim jsession As New JavaSession

	'Find desired Class (JavaClass)
	Set jclass = jsession.GetClass("java/net/InetAddress")
	
	'Get desired object (JavaObject)
	Set localHost = jclass.getLocalHost()
	
	'Access object's methods and properties
	MsgBox "Name: " & localHost.getHostName()
	MsgBox "Address: " & localHost.getHostAddress()
	
	GoTo finally
catch:
	'log error
	'Msgbox Erl & ":" & Error
	MsgBox LSI_Info(2) & " called by " & LSI_Info(12) & "(" & LSI_Info(430) & "): " & Error$ & " - Line: " & CStr(Erl)

	Dim jError As JavaError
	Set jError = jsession.GetLastJavaError()
	MessageBox "Java Error: " & jError.ErrorMsg()
	MessageBox " Stack trace: " & jError.Stacktrace()
	jsession.Clearjavaerror

	'resume to the final thing

	Resume finally
	
	'do the final thingc
finally:
End Sub